package org.frvi.goldspring.business.dao;

import org.frvi.goldspring.business.entity.User;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * User: Frank
 * Date: Oct 15, 2009
 * Time: 10:39:04 PM
 */
@Repository("userDao")
@Transactional
public class UserDaoImpl extends AbstractHibernateDaoImpl<User> implements UserDao {
    public User findByUserName(String userName) {
        return (User) getSessionFactory()
                .getCurrentSession()
                .getNamedQuery(User.FIND_BY_USERNAME)
                .setString("username", userName)
                .uniqueResult();
    }


    @Override
    protected Class getDomainObject() {
        return User.class;
    }
}
